package com.smile.f315;
import java.awt.BasicStroke;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.RoundRectangle2D;
import javax.swing.JFrame;
import javax.swing.JPanel;
class BorderPanel extends JPanel{
	public void paintComponent(Graphics g){
		super.paintComponents(g);
		Graphics2D g2 = (Graphics2D)g;
		float dash[] = {10.0f};
		BasicStroke dashed = new BasicStroke(1.0f,BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER,10.0f,dash,0.0f);
		g2.setStroke(dashed);
		RoundRectangle2D roundRect = new RoundRectangle2D.Double(20.0, 10.0, 200.0, 60.0, 10, 10);
		g2.draw(roundRect);
	}
}
public class BorderDemo {
	public void createUI(){
		JFrame frame = new JFrame("边框属性示例程序");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		BorderPanel panel = new BorderPanel();
		frame.add(panel);
		
		frame.setBounds(200, 200, 250, 120);
		frame.setVisible(true);
	}
	public static void main(String[] args) {
		BorderDemo example = new BorderDemo();
		example.createUI();
	}
}